import { TreeNode } from '../utils/index.ts';

function inorderTraversal(root: TreeNode | null): number[] {
    const result: number[] = [];

    function inorder(root: TreeNode | null): void {
        if (!root) return;
        inorder(root.left);
        result.push(root.val);
        inorder(root.right);
    }

    inorder(root);
    return result;
}
